package pl.edu.agh.som;

import pl.edu.agh.neural.core.ConnectedNeuron;
import pl.edu.agh.neural.simple.InputConnection;

public class Node extends ConnectedNeuron
{
    private int row;
    private int column;
    private double winFrequency;
    private double distance;
    private double value;

    public Node(int row, int column, double initialWinFrequency, InputConnection[] inputConnections)
    {
        super(inputConnections);
        this.row = row;
        this.column = column;
        this.winFrequency = initialWinFrequency;
        this.distance = 0;
    }

    public int getRow()
    {
        return row;
    }

    public int getColumn()
    {
        return column;
    }

    public double getWinFrequency()
    {
        return winFrequency;
    }

    public void setWinFrequency(double winFrequency)
    {
        this.winFrequency = winFrequency;
    }

    public double getDistance()
    {
        return distance;
    }

    public void setDistance(double distance)
    {
        this.distance = distance;
    }

    @Override
    public boolean equals(Object o)
    {
        if (this == o)
        {
            return true;
        }
        if (o == null || getClass() != o.getClass())
        {
            return false;
        }

        Node node = (Node) o;

        return column == node.column && row == node.row;

    }

    @Override
    public int hashCode()
    {
        int result = row;
        result = 31 * result + column;
        return result;
    }

    @Override
    public double getValue()
    {
        return getDistance();
    }
}
